home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / dev / lang / amigatalk.lha / intuition / BoopsiButtonTags.st < prev    next >
Text File  |  2002-05-05  |  5KB  |  149 lines

  1. " -------------------------------------------------------------------- "
  2. " BoopsiButtonTags Class is a Singleton class that allows the user to  "
  3. " reference BOOPSI Button class tags' hexadecimal values.              "
  4. ""
  5. "  EXAMPLE:  'myTag <- buttonTags getTag: #BUTTON_BevelStyle'          "
  6. ""
  7. " ALL singleton classes MUST contain the following:                    "
  8. ""
  9. "   the methods:  isSingleton AND privateSetup     AND                 "
  10. "                 uniqueInstance Class instance variable.              "
  11. " -------------------------------------------------------------------- "
  12.  
  13. Class BoopsiButtonTags :Dictionary ! uniqueInstance !
  14. [
  15.    isSingleton
  16.      ^ true  
  17. |  
  18.    privateNew ! newinstance !
  19.      newinstance <- super new.
  20.  
  21.      ^ newinstance
  22. |
  23.    new
  24.      ^ self privateSetup
  25. |
  26.    getTag: tagKey
  27.      ^ self at: tagKey
  28. |
  29.    privateInitializeDictionary
  30.  
  31.      " (BOOL) Indicate whether button stays depressed when clicked "
  32.      self at: #BUTTON_PushButton  put: 16r84000001. 
  33.  
  34.      " (struct Image *) Indicate that image is to be drawn using
  35.      * BltTemplate. Note this tag is only partial support, only single
  36.      * plane glyphs are rendered correctly.
  37.      "
  38.      self at: #BUTTON_Glyph       put: 16r84000002.
  39.  
  40.      " (LONG) Pen to use for text (-1 uses TEXTPEN) "
  41.      self at: #BUTTON_TextPen     put: 16r84000005.
  42.  
  43.      " (LONG) Pen to use for fill (-1 uses FILLPEN) "
  44.      self at: #BUTTON_FillPen     put: 16r84000006.
  45.  
  46.      " (LONG) Pen to use for fill (-1 uses FILLTEXTPEN) "
  47.      self at: #BUTTON_FillTextPen put: 16r84000007.
  48.  
  49.      " (LONG) Pen to use for fill (-1 uses BACKGROUNDPEN) "
  50.      self at: #BUTTON_BackgroundPen put: 16r84000008.
  51.  
  52.      self at: #BUTTON_RenderImage   put: 16r8003000A. " GA_Image "
  53.      self at: #BUTTON_SelectImage   put: 16r8003000C. " GA_SelectRender "
  54.  
  55.      " Bevel Box Style "
  56.      self at: #BUTTON_BevelStyle    put: 16r8400000D.
  57.  
  58.      " Button is transparent, EraseRect fill pattern used 
  59.      * (if any) to render button background.
  60.      "
  61.      self at: #BUTTON_Transparent   put: 16r8400000F.
  62.  
  63.      " LEFT/RIGHT/CENTER jutification of GA_Text text "
  64.      self at: #BUTTON_Justification put: 16r84000010.
  65.  
  66.      " Sets Font SoftStyle, ie, Bold, Italics, etc "
  67.      self at: #BUTTON_SoftStyle     put: 16r84000011.
  68.  
  69.      " Automatically creates a button with standard scaled glyphs "
  70.      self at: #BUTTON_AutoButton    put: 16r84000012.
  71.  
  72.      " Argument array for GA_Text varargs string "
  73.      self at: #BUTTON_VarArgs       put: 16r84000013.
  74.  
  75.      " (STRPTR) default string used for domain calculation "
  76.      self at: #BUTTON_DomainString  put: 16r84000014.
  77.  
  78.      " (int) integer value to display a numeric string.
  79.      * Useful with notifications from sliders, scrollers, etc
  80.      "
  81.      self at: #BUTTON_Integer       put: 16r84000015.
  82.  
  83.      " (struct BitMap *) BitMap to render in button, rather than an image... "
  84.      self at: #BUTTON_BitMap        put: 16r84000016.
  85.  
  86.      " (BOOL) Is button animatable?  Use to turn animating on or off "
  87.      self at: #BUTTON_AnimButton    put: 16r84000032.
  88.  
  89.      " (struct Image *) Sets an array of struct Images for animation "
  90.      self at: #BUTTON_AnimImages    put: 16r84000033.
  91.  
  92.      " (struct Image *) sets an array of alternate images for a selected
  93.      * state if used, must contain an equal number of images as the
  94.      * array used for BUTTON_AnimImages.  It's wise to use the
  95.      * same-sized images too
  96.      "
  97.      self at: #BUTTON_SelAnimImages put: 16r84000034.
  98.  
  99.      " (LONG) Number of images available in the arrays "
  100.      self at: #BUTTON_MaxAnimImages put: 16r84000035.
  101.  
  102.      " (LONG) Current image number in the array(s) to use
  103.      * the range of available frames is 0..MaxAnimImages-1
  104.      "
  105.      self at: #BUTTON_AnimImageNumber put: 16r84000036.
  106.  
  107.      " (ULONG) Value to be added to the current image number
  108.      * counter.  The counter will wrap around at MaxAnimImages
  109.      "
  110.      self at: #BUTTON_AddAnimImageNumber put: 16r84000037.
  111.  
  112.      " (ULONG) Value to be subtracted from the current image 
  113.      * number counter.  The counter will wrap around when < 0
  114.      "
  115.      self at: #BUTTON_SubAnimImageNumber put: 16r84000038.
  116.  
  117.      " Justification modes for BUTTON_Justification tag: "
  118.  
  119.      self at: #BCJ_LEFT    put: 0.
  120.      self at: #BCJ_CENTER    put: 1.  " default - center text "
  121.      self at: #BCJ_RIGHT    put: 2.
  122.  
  123.      self at: #BCJ_CENTRE    put: 1.
  124.  
  125.      " Built-in button glyphs for BUTTON_AutoButton. "
  126.  
  127.      self at: #BAG_POPFILE    put: 1.  " popup file req "
  128.      self at: #BAG_POPDRAWER    put: 2.  " popup drawer req "
  129.      self at: #BAG_POPFONT    put: 3.  " popup font req "
  130.      self at: #BAG_CHECKBOX    put: 4.  " check glyph button "
  131.      self at: #BAG_CANCELBOX    put: 5.  " cancel glyph button "
  132.      self at: #BAG_UPARROW    put: 6.  " up arrow "
  133.      self at: #BAG_DNARROW    put: 7.  " down arrow "
  134.      self at: #BAG_RTARROW    put: 8.  " right arrow "
  135.      self at: #BAG_LFARROW    put: 9.  " left arrow "
  136.      self at: #BAG_POPTIME    put: 10. " popup time glyph "
  137.      self at: #BAG_POPSCREEN    put: 11. " popup screen mode glyph "
  138.      self at: #BAG_POPUP    put: 12. " generic popup "
  139. |
  140.    privateSetup
  141.      (uniqueInstance isNil)
  142.        ifTrue: [uniqueInstance <- self privateNew.
  143.                 
  144.                 self privateInitializeDictionary.
  145.                ].
  146.                
  147.      ^ self    "or ^ uniqueInstance??"
  148. ]
  149.